import request from '@/utils/request'

/**
 * 获取列表
 */
export function getCourseSeriesList(data) {
  return request({
    url: '/CourseSeries/GetCourseSeriesList',
    method: 'post',
    data
  })
}

export function getCourseSeriesById(id) {
  return request({
    url: '/CourseSeries/GetCourseSeriesById?id=' + id,
    method: 'get'
  })
}

/**
 * 获取课程系列下面的章节列表
 * @param {} id 课程id 
 */
export function getAdminChapterList(id) {
  return request({
    url: '/CourseSeries/GetAdminChapterList?id=' + id,
    method: 'get'
  })
}

export function addModel(data) {
  debugger
  return request({
    url: '/CourseSeries/AddModel',
    method: 'post',
    data
  })
}

export function updateModel(data) {
  return request({
    url: `/CourseSeries/UpdateModel`,
    method: 'post',
    data
  })
}

export function deleteModel(id) {
  return request({
    url: `/CourseSeries/DeleteModel?id=` + id,
    method: 'post'
  })
}

export function changeUserStatus(id, status) {
  return request({
    url: `/CourseSeries/ChangeUserStatus`,
    method: 'post',
    params: { id: id, status: status }
  })
}

export function publishModel(id, status) {
  return request({
    url: `/CourseSeries/PublishModel?id=` + id + '&status=' + status,
    method: 'get'
  })
}

/**
 * 保存课件
 * @param {*} data 
 */
export function saveCourseFile(data) {
  return request({
    url: `/CourseSeries/SaveCourseFile`,
    method: 'post',
    data
  })
}

/**
 * 审核课程
 * @param {*} data 
 */
export function CheckCourse(data) {
  return request({
    url: `/CourseSeries/CheckCourse`,
    method: 'post',
    data
  })
}

export function setState(id, state) {
  return request({
    url: `/CourseSeries/SetState?id=` + id + '&state=' + state,
    method: 'get'
  })
}

/**
 * 获取课程详情
 * @param {*} id 课程id
 */
export function getCourseById(id) {
  return request({
    url: `/CourseSeries/GetCourseById?id=` + id,
    method: 'get'
  })
}
